<template>
	<view class="shop">
		<view class="list">
			<view class="item" v-for="(item, index) in shopList" :key="index">
				<view class="sign" @click="getShopInfo(item.id)">
					<view class="left">
						<image :src="item.logo" mode=""></image>
					</view>
					<view class="right">
						<!-- 公司名称 -->
						<view class="shop_name">
							<view class="renzheng" v-if="item.approve == 1">认证</view>
							<view class="renzheng" v-else>未认证</view>
							<view class="name">{{ item.companyname ? item.companyname : item.realname }}</view>
						</view>
						<!-- 描述 -->
						<view class="desc">
							{{ item.name }}
						</view>
						<!-- 评分 -->
						<view class="gate">
							<view class="pf">
								<text class="goodrate">好评率</text>
								<text class="num">100%</text>
							</view>
							<view class="done">
								已服务100次
							</view>
							<!-- <view class="far">
								距我<text class="juji">1.1</text>公里
							</view> -->
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				shopList: [],
				
			}
		},
		computed: {
			city() {
				return this.$store.state.cityInfo.city
			},
		},
		watch: {
			city() {
				this.getShopList()
			},
		},
		mounted() {
			this.getShopList()
		},
		methods: {
			// 获取商家
			async getShopList() {
				let self = this
				//console.log(this.city)
				let res = await this.$Request("POST", "/Index/technology", { city: this.city })
				// console.log(res)
				this.shopList = res.data.data
			},
			// 获取商家详情
			getShopInfo( id ) {
				uni.navigateTo({
					url: `/pages/master/master?shopid=${id}`
				})
			},
			
		},
	}
</script>

<style lang="scss">
	.shop {
		width: 100%;
		padding: 20rpx 30rpx;
		box-sizing: border-box;
		.list {
			width: 100%;
			.item {
				width: 100%;
				margin: 20rpx 0;
				background-color: #fff;
				border-radius: 20rpx;
				.sign {
					width: 100%;
					display: flex;
					padding: 20rpx;
					box-sizing: border-box;
					.left {
						width: 150rpx;
						height: 150rpx;
						border-radius: 10rpx;
						overflow: hidden;
						image {
							width: 150rpx;
							height: 150rpx;
						}
					}
					.right {
						flex: 1;
						margin-left: 30rpx;
						height: 150rpx;
						.shop_name {
							display: flex;
							align-items: center;
							.renzheng {
								height: 40rpx;
								width: 80rpx;
								background-color: #409EFF;
								color: #fff;
								text-align: center;
								font-size: 20rpx;
								line-height: 40rpx;
							}
							.name {
								margin-left: 20rpx;
								width: 350rpx;
								overflow: hidden;
								text-overflow: ellipsis;
								white-space: nowrap;
							}
						}
						.desc {
							font-size: 24rpx;
							color: #999999;
							line-height: 60rpx;
							width: 350rpx;
							overflow: hidden;
							text-overflow: ellipsis;
							white-space: nowrap;
						}
						.gate {
							width: 100%;
							
							display: flex;
							
							.pf {
								color: orange;
								margin-right: 40rpx;
								image {
									width: 30rpx;
									height: 30rpx;
								}
							}
							.far {
								color: #999999;
							}
						}
					}
				}
			}
		}
	}
</style>
